﻿using UnityEngine;
using System.Collections;

public class Pipe : MonoBehaviour {

	// Use this for initialization
	void Start () {
        RandomGeneratePosition();
	}
	
	// Update is called once per frame
	void Update () {

	}

    public void RandomGeneratePosition()
    {
        float pos_y = Random.Range(0f, 0.2f);
        this.transform.localPosition = new Vector3(this.transform.localPosition.x, pos_y, this.transform.localPosition.z);
    }

    void OnTriggerExit(Collider other)
    {
        if (other.tag == "Player")
        {
            GameSvc.Instance.Score++;
        }
    }

    void OnGUI()
    {
        GUILayout.Label("SCORE:" + GameSvc.Instance.Score);
    }
}
